package vule.audio;

import java.io.InputStream;
import java.net.URL;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;

import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;

public class AudioUtils {

	
	public static void play(String sound) {
		try {
			URL resource = AudioUtils.class.getResource(sound);
			Media hit = new Media(resource.toString());
			MediaPlayer mediaPlayer = new MediaPlayer(hit);
			mediaPlayer.play();
//			Clip clip = AudioSystem.getClip();
//			InputStream stream = AudioUtils.class.getResourceAsStream(sound);
//			AudioInputStream inputStream = AudioSystem.getAudioInputStream(stream);
//	        clip.open(inputStream);
//	        clip.start(); 
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	
}
